package cn.wsalix.admin.service;

import java.util.List;

import cn.anlaser.service.ParentService;
import cn.wsalix.admin.entity.MenuPermit;
import cn.wsalix.admin.entity.RequiresPermit;
import cn.wsalix.admin.entity.RequiresRole;
import cn.wsalix.admin.entity.SysRole;
import cn.wsalix.admin.form.RoleForm;
import cn.wsalix.admin.repository.RoleRepository;

public interface RoleService extends
		ParentService<RoleForm, RoleRepository, SysRole> {

	/**
	 * @param id
	 * @return
	 */
	List<SysRole> findRolesByUserId(Long userId);

	/**
	 * @param id
	 * @return
	 */
	List<MenuPermit> findPermitsByUserId(Long userId);

	/**
	 * @param userId
	 * @return
	 */
	List<SysRole> findUnRolesByUserId(Long userId);

	List<SysRole> findRolesByMenuId(Long menuId);

	/**
	 * @param userId
	 * @return
	 */
	List<SysRole> findUnRolesByMenuId(Long menuId);

	/**
	 * @param roleId
	 *            更新角色对应的用户权限
	 */
	public void upUserRole(Long roleId);

	/**
	 * @return 获取所有权限
	 */
	List<MenuPermit> findAllMenuPermit();

	public SysRole findByCodeOne(String code);

	public SysRole findByNameOne(String name);

	public List<SysRole> findsByName(String name);

	public List<SysRole> findsByCode(String code);

	/**
	 * @return
	 * 获取所有角色
	 */
	List<RequiresRole> findRequiresRoles();

	/**
	 * @return
	 * 获取所有权限
	 */
	List<RequiresPermit> findRequiresPermits();

}
